var
  i, j: longint;
  x: boolean;
begin
    read(i);
    j := i - 1;
    x := False;
    while (j > 0) do begin
      x := Boolean(j mod 2) xor x;
      j := j div 2;
    end;
    writeln(byte(x));
end.
